class DbSingle {

    static getInstance () {
        if (!DbSingle.instance) {
            DbSingle.instance = new DbSingle()
        }
        return DbSingle.instance
    }

    constructor () {
        console.log('数据库实例化')
        this.connect()
    }
    
    connect () {
        console.log('链接数据库')
    }

    find () {
        console.log('查询数据库')
    }
}

let d1 = DbSingle.getInstance()
let d2 = DbSingle.getInstance()
d1.find()
d2.find()